<?php
Yii::import('zii.widgets.CPortlet');

class Portlet extends CPortlet{
	
	private $_openTag;
	
	public function init()
	{
		ob_start();
		ob_implicit_flush(false);
//		$this->htmlOptions['id']=$this->getId();
		echo CHtml::openTag($this->tagName,$this->htmlOptions)."\n";
		$this->renderDecoration();
//		echo "<div class=\"{$this->contentCssClass}\">\n";

		$this->_openTag=ob_get_contents();
		ob_clean();
	}
	
	public function run()
	{
		$this->renderContent();
		$content=ob_get_clean();
		if($this->hideOnEmpty && trim($content)==='')
			return;
		echo $this->_openTag;
		echo $content;
//		echo "</div>\n";
		echo CHtml::closeTag($this->tagName);
	}
}